<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "sys_item_place".
 *
 * @property integer $id
 * @property integer $item_id
 * @property integer $place_id
 */
class SysItemPlace extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'sys_item_place';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['item_id', 'place_id'], 'integer'],
            [['item_id', 'place_id'], 'unique', 'targetAttribute' => ['item_id', 'place_id'], 'message' => 'The combination of Item ID and Place ID has already been taken.']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'item_id' => 'Item ID',
            'place_id' => 'Place ID',
        ];
    }
    public function getGrpName()
    {
    	return $this->hasOne(GrpPlace::className(),['id'=>'place_id']);
    }
}
